BundleCompat
Helper for accessing features in Bundle.
Functions
Link copied to clipboard
Returns the value associated with the given key or
null
if: - No mapping of the desired type exists for the given key.
- A
null
value is explicitly associated with the key. - The object is not of type
clazz
.
Link copied to clipboard
open fun getParcelableArray(@NonNull in: Bundle, @Nullable key: String, @NonNull clazz: Class<out Parcelable>): Array<Parcelable>
Returns the value associated with the given key, or
null
if: - No mapping of the desired type exists for the given key.
- A
null
value is explicitly associated with the key. - The object is not of type
clazz
.
Link copied to clipboard
open fun <T> getParcelableArrayList(@NonNull in: Bundle, @Nullable key: String, @NonNull clazz: Class<out T>): ArrayList<T>
Returns the value associated with the given key, or
null
if: - No mapping of the desired type exists for the given key.
- A
null
value is explicitly associated with the key. - The object is not of type
clazz
.
Link copied to clipboard
open fun <T : Serializable?> getSerializable(@NonNull in: Bundle, @Nullable key: String, @NonNull clazz: Class<T>): T
Returns the value associated with the given key or
null
if: - No mapping of the desired type exists for the given key.
- A
null
value is explicitly associated with the key. - The object is not of type
clazz
.
- SDK 34 and above, this method matches platform behavior.
- SDK 33 and below, the object type is checked after deserialization.
Link copied to clipboard
open fun <T> getSparseParcelableArray(@NonNull in: Bundle, @Nullable key: String, @NonNull clazz: Class<out T>): SparseArray<T>
Returns the value associated with the given key, or
null
if: - No mapping of the desired type exists for the given key.
- A
null
value is explicitly associated with the key. - The object is not of type
clazz
.
- SDK 34 and above, this method matches platform behavior.
- SDK 33 and below, this method will not check the array elements' types.